package us.wili.dev.common.util.xinge.v2.exception;

import us.wili.dev.common.util.xinge.v2.XinGeUtilErrorCode;

/**
 * author: lefore
 * date: 2018/8/30
 */
public class XinGeException extends RuntimeException {

    private Integer code;
    private String msg;

    public XinGeException(XinGeUtilErrorCode errorCode) {
        super(errorCode.getMsg());
        this.code = errorCode.getCode();
        this.msg = errorCode.getMsg();
    }

    public XinGeException(XinGeUtilErrorCode errorCode, Throwable e) {
        super(errorCode.getMsg(), e);
        this.code = errorCode.getCode();
        this.msg = errorCode.getMsg();
    }

    public XinGeException(Integer code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    public XinGeException(String message, Integer code, String msg) {
        super(message);
        this.code = code;
        this.msg = msg;
    }

    public XinGeException(String message, Throwable cause, Integer code, String msg) {
        super(message, cause);
        this.code = code;
        this.msg = msg;
    }

    public XinGeException(Throwable cause, Integer code, String msg) {
        super(cause);
        this.code = code;
        this.msg = msg;
    }

    public XinGeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Integer code, String msg) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
